import java.util.Arrays;
import java.util.Scanner;

/**
 * 【程序36】   
 * 题目：有n个整数，使其前面各数顺序向后移m个位置，最后m个数变成最前面的m个数 
 */
public class test36 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] array1 = new int[7];
        int[] array2 = new int[7];
        for (int i = 0; i < 7; i++) {
            System.out.print("请依次输入7个数：");
            array1[i] = sc.nextInt();
        }
        System.out.println("原数组为：" + Arrays.toString(array1));
        System.out.print("请输入你所需后移的个数：");
        int move = sc.nextInt();
        for (int i = 0; i < move; i++) {
            array2[i] = array1[7 - move + i];
        }
        System.arraycopy(array1, 0, array2, move, 7 - move);
        System.out.println("移动后数组为：" + Arrays.toString(array2));
    }
}
